// app.js
App({
  onLaunch() {
    wx.setStorageSync('userInfo_role','student')
    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
        // 调用接口获取用户信息
      }
    })
    
    this.getSysInfo();
  },
  getSysInfo() {
    try {
      let menuButtonBounding = wx.getMenuButtonBoundingClientRect();
      this.globalData.menuButtonBounding = menuButtonBounding;
      const res = wx.getSystemInfoSync();
      let SCREEN_WIDTH = 750; //宽固定
      let RATE = SCREEN_WIDTH / res.screenWidth; //换算比例
      this.globalData.RATE = RATE;
      this.globalData.SDKVersion = res.SDKVersion;
      this.globalData.adaptationHeight = res.statusBarHeight * 2 + 10;
      this.globalData.height = res.screenHeight;
      this.globalData.height_rpx = res.screenHeight * RATE;
      this.globalData.width = res.screenWidth;
      this.globalData.platform = res.platform;
    } catch (err) {
      setTimeout(() => {
        this.getSysInfo();
      }, 1000);
    }
  },
  globalData: {
    isBgMusic:true,// 是否使用背景音乐
    playIndex: 0, //当前播放列表的index
    nowList:{},
    userInfo_role:'student'
  },
})
